using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Security;

namespace IWS.Lib.SingleSignOnServer
{
	[Serializable]
	public class UserCollectionResult
	{
		public int TotalRecords;
		private MembershipUserProxy[] m_oMatchingUsers;

		public MembershipUserProxy[] MatchingUsers
		{
			get { return m_oMatchingUsers; }
			set { m_oMatchingUsers = value; }
		}

		public UserCollectionResult()
		{
			this.TotalRecords = 0;
			this.MatchingUsers = null;
		}

		public MembershipUserCollection GetUserCollection()
		{
			if (this.MatchingUsers != null)
			{
				MembershipUserCollection colList = new MembershipUserCollection();
				for (int ix = 0; ix < this.MatchingUsers.Length; ix++)
				{
					colList.Add(this.MatchingUsers[ix].GetMembershipUser());
				}
				return colList;
			}
			return null;
		}
		public void SetUserCollection(MembershipUserCollection users)
		{
			this.TotalRecords = 0;
			this.MatchingUsers = null;
			if (users != null && users.Count > 0)
			{
				this.MatchingUsers = new MembershipUserProxy[users.Count];
				int ix = 0;
				foreach (MembershipUser user in users)
				{
					this.MatchingUsers[ix] = new MembershipUserProxy(user);
					ix++;
				}
				this.TotalRecords = this.MatchingUsers.Length;
			}
		}
	}
}
